<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->default("")->comment('姓名');
            $table->string('phone', 190)->comment('手机号');
            $table->string('password')->default("")->comment('密码');
            $table->integer('agency_id')->default(0)->comment('所属机构id');
            $table->tinyInteger('type_id')->default(1)->comment('类型(1学校2家长3培训机构)');
            $table->string('openid')->default("")->comment("用户登陆openid");
            $table->tinyInteger('status')->default(0)->comment('状态');
            $table->rememberToken();
            $table->timestamps();
            $table->softDeletes();
            $table->unique(['phone', 'agency_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
